Skip to content

net: add DHCP Option 121 (Classless Static Routes) support#2123

Open
tpjg wants to merge 2 commits intonanovms:masterfrom
tpjg:dhcp-option121
Open

net: add DHCP Option 121 (Classless Static Routes) support#2123
tpjg wants to merge 2 commits intonanovms:masterfrom
tpjg:dhcp-option121

Conversation

@tpjg
Copy link

@tpjg tpjg commented Jan 4, 2026

Implement RFC 3442 classless static routes received via DHCP to support receiving multiple routes (not just a default gateway). This is especially useful for servers deployed with multiple interfaces, e.g. one 'public' and one 'private' network interface.

Amongst other things this can be used to receive the route to reach the http://169.254.169.254 endpoint.

This has been tested on OpenStack / OVHcloud. Note that this also requires a change in the vendored LWIP (the makefile now pulls from my fork).

Not sure if this is interesting to get into upstream and it definitely needs (a lot of) review, sharing nonetheless.

Timo Gatsonides and others added 2 commits January 4, 2026 12:12
Implement RFC 3442 classless static routes received via DHCP:

- Add IPv4 static route table with longest-prefix-match lookup
- Parse Option 121 from DHCP ACK via LWIP_HOOK_DHCP_PARSE_OPTION
- Consult static routes during IP routing via LWIP_HOOK_IP4_ROUTE_SRC
- Ignore Option 3 (Router) when Option 121 is present per RFC 3442
- Request Option 121 in DHCP parameter request list
- Clean up routes on DHCP release/stop

Note: vendor/lwip/src/core/ipv4/dhcp.c also requires modification (see
Makefile).
Copy link
Member

@francescolavra francescolavra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tpjg thanks for your PR.
This feature can be implemented entirely within lwIP, I don't see any advantage in implementing it in the Nanos code base. The fact that you had to make changes to lwIP means that doing everything via lwIP hooks is not feasible, and lwIP needs to be aware of this feature.
So I would rather have everything done inside lwIP.

@tpjg
Copy link
Author

tpjg commented Jan 11, 2026

Okay, I'll look into moving everything into lwIP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants